package com.quanquan.management.controller;

import com.quanquan.management.dto.DataDTO;
import com.quanquan.management.service.DataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @ClassName:DataController
 * @Description:TODO
 * @Author:xiongjunbao
 * @Date:2019/5/9 10:46
 * @Version 1.0
 */
@Controller
@RequestMapping("/data")
public class DataController extends ManagerBaseController {

    private final DataService dataService;

    @Autowired
    public DataController(DataService dataService) {
        this.dataService = dataService;
    }

    @RequestMapping("/welcome")
    public String welcome(Model model) {
        DataDTO dataDTO = dataService.findData();
        model.addAttribute("editable", dataDTO);
        return "/mainIndex";
    }

}
